package com.nahan.secondapplication

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.nahan.secondapplication.customSpinner.NiceSpinner
import com.nahan.secondapplication.customSpinner.OnSpinnerItemSelectedListener
import com.nahan.secondapplication.goodsdetail.spinner.CustomSpinner.OnSpinnerEventsListener
import kotlinx.android.synthetic.main.activity_custom.*
import java.util.*
import kotlin.collections.ArrayList


class CustomActivity : AppCompatActivity() {

    var dataset: List<String> =
        LinkedList(Arrays.asList("One", "Two", "Three", "Four", "Five","six"))



    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_custom)

        initview()
    }

    private fun initview() {
        val list: ArrayList<String> = ArrayList(
            Arrays.asList(
                "C_1", "C_2", "C_3", "C_4", "C_5",
                "C_6", "C_7", "C_8", "C_9", "C_10", "C_11", "C_12", "C_13", "C_14"
            )
        )
        ms.setMemoryCount(4)
        ms.setData(null, list)



        nice_spinner.attachDataSource(dataset)
        nice_spinner.setOnSpinnerItemSelectedListener(object : OnSpinnerItemSelectedListener {
            override fun onItemSelected(
                parent: NiceSpinner?,
                view: View?,
                position: Int,
                id: Long
            ) {
                val item: String =parent!!.getItemAtPosition(position) as String
            }

        })

        var types = resources.getStringArray(R.array.number_array)
        number_spinner.initializeStringValues(types, "111");
        number_spinner.setSpinnerEventsListener(object : OnSpinnerEventsListener {
            override fun onSpinnerOpened() {
            }

            override fun onSpinnerClosed() {
            }
        })
    }


}
